//
//  HJDBannerOneViewController.m
//  JYHospital
//
//  Created by 胡金东 on 16/5/16.
//  Copyright © 2016年 胡金东. All rights reserved.
//

#import "HJDBannerOneViewController.h"
#import "HJDBannerOneCell.h"
#import "HJDBannerOneModel.h"

@interface HJDBannerOneViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong) UITableView * tableView;
@property (nonatomic,strong) NSArray * dataArray;



@end

@implementation HJDBannerOneViewController

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    self.dataArray = [HJDBannerOneModel infoArray];
     self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(backBtnClick) image:@"︿" HighImage:nil];
}
//返回
-(void)backBtnClick{
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier = @"Cell";
    HJDBannerOneCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[HJDBannerOneCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    HJDBannerOneModel * model = self.dataArray[indexPath.row];
    cell.ImageV.image = [UIImage imageNamed:model.image];
    cell.name.text = model.name;
    cell.departments.text = model.departments;
    cell.post.text = model.post;
    cell.introduce.text = model.introduce;
    cell.year.text = model.year;
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 150;
}

@end
